hysop.operator.mean_field module

I/O operators

  • HDF_Writer : operator to write fields into an hdf file

  • HDF_Reader : operator to read fields from an hdf file

  • ComputeMeanField abstract interface for hdf io classes

class hysop.operator.mean_field.ComputeMeanField(fields, variables, io_params, **kwds)[source]

Bases: HostOperatorBase

Interface to compute the mean of a field in chosen axes.

Compute and write the mean of fields in given direction, possiblity on a subview.

Parameters:
  • fields (dict Field: (view, axes)) – Keys are the field, values represent underlying view and axes where to take the mean. View = array_like of slices, Ellipsis, or 2D-tuples. A tuple represent minimal and maximal physical coordinates.

  • variables (dict) – dictionary of fields as keys and topologies as values.

  • io_params (hysop.tools.io_utils.IOParams) – File i/o config (filename, format …) Filename is used as a subfolder.

  • kwds (dict) – Base class arguments.

apply(**kwds)

Abstract method that should be implemented. Applies this node (operator, computational graph operator…).

discretize()[source]

By default, an operator discretize all its variables. For each input continuous field that is also an output field, input topology may be different from the output topology.

After this call, one can access self.input_discrete_fields and self.output_discrete_fields, which contains input and output dicretised fields mapped by continuous fields.

self.discrete_fields will be a tuple containing all input and output discrete fields.

Discrete tensor fields are built back from discretized scalar fields and are accessible from self.input_tensor_fields, self.output_tensor_fields and self.discrete_tensor_fields like their scalar counterpart.

filename(field, i)[source]
get_field_requirements()[source]

Called just after handle_method(), ie self.method has been set. Field requirements are:

  1. required local and global transposition state, if any.

  2. required memory ordering (either C or Fortran)

Default is Backend.HOST, no min or max ghosts, MemoryOrdering.ANY and no specific default transposition state for each input and output variables.

setup(work=None)[source]

Setup temporary buffer that have been requested in get_work_properties(). This function may be used to execute post allocation routines. This sets self.ready flag to True. Once this flag is set one may call ComputationalGraphNode.apply() and ComputationalGraphNode.finalize().

Automatically honour temporary field memory requests.

classmethod supported_backends()[source]

Return the backends that this operator’s topologies can support as a set. By default all operators support only Backend.HOST.